﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package net.wooga.pets.views {
    import flash.events.*;
    import net.wooga.pets.events.*;
    import net.wooga.pets.controllers.data.*;
    import net.wooga.pets.models.*;
    import net.wooga.pets.views.components.computerdisplay.*;
    import net.wooga.pets.constants.*;
    import net.wooga.pets.utils.*;

    public class ComputerMediator_W extends ComputerMediator {

        override protected function createPetBoxes(_arg1:Array):void{
            var _local6:PatientPoolVO;
            var _local8:PetBox;
            var _local10:String;
            var _local11:Boolean;
            var _local2:String = languageModel.getTextByKey("global_needs");
            var _local3:String = languageModel.getTextByKey("reception_selectionbox_needrooms");
            var _local4:String = languageModel.getTextByKey("global_reward");
            var _local5:String = languageModel.getTextByKey("global_build_now");
            var _local7:PetBoxDisplayData = new PetBoxDisplayData();
            var _local9:int;
            while (_local9 < _arg1.length) {
                _local6 = _arg1[_local9];
                _local7.index = _local9;
                _local7.needsLabel = _local2;
                _local7.needsRoomsLabel = _local3;
                _local7.rewardsLabel = _local4;
                _local7.diseaseName = _local6.diseaseName;
                _local7.coins = _local6.coins;
                _local7.xp = _local6.xp;
                _local7.petType = _local6.petType;
                _local10 = ("pet_" + _local6.petType.toLowerCase());
                _local7.name = languageModel.getTextByKey(_local10);
                _local7.duration = _local6.duration;
                _local7.durationLabel = TimeUtils.getComputerDisplayDurationFormat(_local6.duration, languageModel.getTextByKey("reception_selectionbox_roomminutes"), languageModel.getTextByKey("reception_selectionbox_roomhours"), languageModel.getTextByKey("reception_selectionbox_roomhours_sing"), languageModel.getTextByKey("reception_selectionbox_roomdays"), languageModel.getTextByKey("reception_selectionbox_roomday"));
                _local7.missingRoomTypes = _local6.missingRoomTypes;
                _local7.treatments = _local6.treatments;
                _local7.hasMinLevel = _local6.hasMinLevel;
                _local7.minLevelLabel = languageModel.getTextByKey("global_levelnumber", {levelnumber:_local6.minLevel});
                _local7.diseaseId = _local6.diseaseId;
                _local7.buildNowButtonLabel = _local5;
                _local7.durationType = _local6.durationType;
                _local7.rewardIcon = _local6.rewardIcon;
                _local7.numberOfRewards = String(_local6.numberOfRewards);
                _local11 = world.hasAreaType(GameConstants.TYPE_FOUNTAIN);
                _local8 = computerDisplay.createPetBox(_local7, _local11);
                if (((_local6.isLocked) && (_local8.buildButton))){
                    _local8.buildButton.addEventListener(MouseEvent.CLICK, buildRoomButton_click);
                } else {
                    _local8.enabled = false;
                };
                _local9++;
            };
        }
        override protected function showComputerDisplay(_arg1:InfoEvent):void{
            var _local2:Array;
            dispatch(new InfoEvent(EventConstants.REMOVE_SPEECHBUBBLE_FROM_LAYER, null));
            l("SHOW DISPLAY");
            if (!computerDisplay.isOpen()){
                l("OPEN COMPUTER");
                if ((((tutorialModel.state > TutorialModel.FOUNTAIN_START_TUTORIAL)) && ((tutorialModel.state < TutorialModel.FOUNTAIN_FINISH_TUTORIAL)))){
                    return;
                };
                _local2 = _arg1.info.pets;
                computerDisplay.morePetsAreAllowed = true;
                tickModel.pause = true;
                this.createPetBoxes(_local2);
                computerDisplay.show();
                track("open");
            };
        }

    }
}//package net.wooga.pets.views 
